import { IPSSysCss } from './ipssys-css';
import { IPSSysEditorStyle } from './ipssys-editor-style';
import { IPSSysPFPlugin } from './ipssys-pfplugin';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysEditorStyleImpl extends PSModelObjectImpl implements IPSSysEditorStyle {
  get ajaxHandlerType(): 'None' | 'CodeList' | 'PickupText' | 'AC' | 'Custom' {
    return this.M.ajaxHandlerType;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get containerType(): 'FORMITEM' | 'GRIDCOLUMN' | 'PANELFIELD' {
    return this.M.containerType;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get editorHeight(): number {
    return this.M.editorHeight;
  }

  get editorType(): string {
    return this.M.editorType;
  }

  get editorWidth(): number {
    return this.M.editorWidth;
  }

  get linkViewShowMode(): 'NORMAL' | 'MODAL' | 'EMBEDDED' {
    return this.M.linkViewShowMode;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssyscss: IPSSysCss | null = null;

  getPSSysCss(): IPSSysCss | null {
    if (this.pssyscss != null) return this.pssyscss;
    const value = this.M.getPSSysCss;
    if (value == null) {
      return null;
    }
    this.pssyscss = this.getPSModel4('res.IPSSysCss', value, 'getPSSysCss') as IPSSysCss;
    return this.pssyscss;
  }

  get psSysCss(): IPSSysCss | null {
    return this.getPSSysCss();
  }

  getPSSysCssMust(): IPSSysCss {
    const value = this.getPSSysCss();
    if (value == null) {
      throw new Error('未指定界面样式表');
    }
    return value;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端应用插件');
    }
    return value;
  }

  get refViewShowMode(): 'NORMAL' | 'MODAL' | 'EMBEDDED' {
    return this.M.refViewShowMode;
  }

  get styleCode(): string {
    return this.M.styleCode;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get extendStyleOnly(): boolean {
    return this.M.extendStyleOnly != null ? this.M.extendStyleOnly : false;
  }

  get replaceDefault(): boolean {
    return this.M.replaceDefault;
  }

  get cls(): string {
    return 'PSSysEditorStyleImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'res.IPSSysEditorStyle') return true;
    return super.instanceof(cls);
  }
}
